QuickTime 3 Reference

Previous | Chapter Top | Chapter Contents | Next

Component Aliases

QuickTime 3 supports a new type of component, known as a component alias, that is a reference to another component. A component alias does not contain code. The component it refers to, known as the target component, contains the necessary code. For example, a client of the base instrument component in the QuickTime music architecture is an alias to the base instrument component. The capabilities of the instrument are defined by the alias's data resources, and the code resource for the instrument is in the base instrument component.

If there are several related components that use the same code, such as importers for related file types, you can use component aliases to share the code rather than duplicating it for each component. Each of the component aliases can have its own subtype, manufacturer, name, icon, and other characteristics, even though it shares code with other components.

Contents of a Component Alias

A component alias is contained in a resource of type kComponentAliasResourceType . This resource contains a component alias resource data structure:

struct ComponentAliasResource {
    ComponentResource      cr;  /* registration parameters */
    ComponentDescription   aliasCD;/* target description */
};

The cr field is a ComponentResource structure that contains information needed to register the component. This information is used in the same way as registration information for ordinary components, with one exception: the specification of the code resource for the component is ignored.

The aliasCD field is a ComponentDescription structure that specifies the target for the alias. The next section, "How a Component Alias Is Resolved" , explains how this structure is used to find the target. The code resource of the target is used in place of the code resource specified in the cr field of the ComponentAliasResource structure.

How a Component Alias Is Resolved

To resolve a component alias, the Component Manager passes the contents of the aliasCD field of the ComponentAliasResource structure to the FindNextComponent function, just as an application would. This field includes all the information that is necessary to specify the target component. If there is no component that matches the specifications, the request to open the alias fails.

The Component Manager never resolves a component alias until the alias is opened. This lets you register component aliases before their target components are registered. It also lets you replace target components with other components.

Scope of a Component Alias

It appears that there's no way to set the registerCmpGlobal flag for a component alias that is stored in the Extensions folder and then automatically registered. Like other components, a component alias has a scope that determines which applications can use its services. If its scope is global, its services are available to all applications. If its scope is local, its services are available only to the application that registers it. The scope of a component alias is determined by the scope of its target component.


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next